<?php 
class Student_model extends CI_Model
{
	public function __construct()
	{
		$this->load->database();
	}

	public function login($id,$pwd)
	{
		$query = $this->db->get_where('student',array('id'=>$id,'pwd'=>$pwd));
		//row_array()只取查询结果的第一行
		return $query->row_array();
	}

	public function read_student($id)
	{
		$query = $this->db->get_where('student',array('id'=>$id));
		return $query->row_array();
	}

	public function verify_result()
	{
		$query = 'select student.id,student.name,student.class,
			result.status,result.total_score from student left join result on student.id=result.id';
		$data = $this->db->query($query);
		return $data->result_array();
	}
}
 ?>